package cn.itsource.basic.controller;

import cn.itsource.basic.util.AjaxResult;
import cn.itsource.basic.util.OssUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/file")
public class FileController {

    /**
     * oss上传接口
     * @param ossFile 前台传过来的key值  v就是MultipartFile
     * @return
     */
    @RequestMapping("/ossUpload")
    public AjaxResult ossUpload(@RequestParam("file") MultipartFile ossFile){

        return AjaxResult.createSuccess(OssUtils.uploadFile(ossFile));
    }


}
